package com.gu.completableFuture;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 测试
 */
public class TestCompletableFuture {

    public static ExecutorService executorService = Executors.newFixedThreadPool(10);


    public static void main(String[] args) throws ExecutionException, InterruptedException {
        System.out.println("main方法开始");

        CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> {

            int i = 10 / 2;
            System.out.println("结果为：" + i);
            return i;
        }, executorService);

        Integer integer = future.get();






        System.out.println("main方法结束,计算结果为........." + integer);
    }
}
